﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Meraz.Core.Model;

namespace Meraz.Core.Repositories
{
    public interface ITwitterTagRepository : IRepository<TwitterTag, long> { }
    public class TwitterTagRepository : EFRepositoryBase<TwitterTag, long>, ITwitterTagRepository
    {

        public override TwitterTag GetById(long id)
        {
            throw new NotImplementedException();
        }

        public TwitterTag GetById(long id, int sequence)
        {
            return context.TwitterTags
                .Where(where1 => where1.TweetID == id && where1.Sequence == sequence)
                .FirstOrDefault();
        }

        public List<TwitterTag> GetByTweetId(long id)
        {
            return this.context.TwitterTags.Where(where1 => where1.TweetID == id).ToList();
        }

        public override void Add(TwitterTag entity)
        {
            this.context.AddToTwitterTags(entity);
        }

        public override void Delete(TwitterTag entity)
        {
            context.TwitterTags.DeleteObject(entity);
        }

        public override List<TwitterTag> All()
        {
            return this.context.TwitterTags.ToList();
        }
    }
}
